using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sysgeprava.Entities;

namespace Sysgeprava.Repository.Mapping
{
    public class ORDENOMap : EntityTypeConfiguration<ORDENO>
    {
        public ORDENOMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("ORDENO");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Fecha).HasColumnName("Fecha");
            this.Property(t => t.Cantidad).HasColumnName("Cantidad");
            this.Property(t => t.IdResponsable).HasColumnName("IdResponsable");

            // Relationships
            this.HasRequired(t => t.RESPONSABLE)
                .WithMany(t => t.ORDENOes)
                .HasForeignKey(d => d.IdResponsable);

        }
    }
}
